PROJECT=Receiver

PROCESSOR=PIC16F88
SERIES=16

HEX=../../hex
OBJ=../../obj/${PROJECT}

PIC_LD=wine ${SOURCEBOOST}/boostlink.pic.exe -t ${PROCESSOR} -ld ${SOURCEBOOST}/Lib/ libc.pic${SERIES}.lib

PIC_CC=wine ${SOURCEBOOST}/boostc.pic${SERIES}.exe -t ${PROCESSOR} -i -obj ${OBJ}

all: ${HEX}/${PROJECT}_boost.hex ${HEX}/${PROJECT}_gpasm.hex

${HEX}/${PROJECT}_boost.hex: ${OBJ}/receiver.obj ${OBJ}/usart.obj ${OBJ}/crc16.obj
	$(PIC_LD) -p ${PROJECT}_boost -d ${HEX} $^

${HEX}/${PROJECT}_gpasm.hex: ${HEX}/${PROJECT}_boost.hex
	gpasm -p ${PROCESSOR} -o ${HEX}/${PROJECT}_gpasm.hex ${HEX}/${PROJECT}_boost.asm

${OBJ}/receiver.obj: receiver.c usart.h crc16.h
	$(PIC_CC) $<

${OBJ}/usart.obj: usart.c usart.h
	$(PIC_CC) $<

${OBJ}/crc16.obj: crc16.c crc16.h
	$(PIC_CC) $<

clean:
	rm ${OBJ}/*

distclean: clean
	rm ${HEX}/${PROJECT}*
